// PRText.cpp
//

#include "PursuitRender.h"

LPD3DXFONT PR_TextFont;

PRENDER_API PDRESULT PRInitText(void)
{
	HRESULT hr = D3DXCreateFont(PR_D3D_Device, 20, 0, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &PR_TextFont);

	if (FAILED(hr))
	{
		return PDERROR_DXTEXTINIT;
	}

	return PD_OK;
}

PRENDER_API void PRDrawText(char* text, int x, int y, D3DCOLOR color)
{
	RECT rect = { x, y, 0, 0 };

	PR_DxSprite->Begin(D3DXSPRITE_ALPHABLEND);

	PR_TextFont->DrawTextA(PR_DxSprite, text, -1, &rect, DT_CALCRECT, 0);
	PR_TextFont->DrawTextA(PR_DxSprite, text, -1, &rect, DT_LEFT, color);

	PR_DxSprite->End();
}